
<template>
    <div class="field-control">
        <SelectControl :string="selectString" :disabled="disabled" :data="rangeList" :value="value" @input="$emit('input',$event)">
        </SelectControl>
        <div class="field-message" v-show="!validate">{{message}}</div>
    </div>
</template>
<script>
import $ from '@/common'
import base from './base'
import SelectControl from '@/element/select'
import Field from '../type'
export default {
    extends: base,
    computed: {
        rangeList() {
            if (this.fieldModel.type === 'state') {
                return Field.state.parseRangeset(this.fieldModel)
            } else {
                if (this.fieldModel.rangeset && $.isArray(this.fieldModel.rangeset)) {
                    return this.fieldModel.rangeset
                }
            }
        },
        selectString() {
            if ($.isArray(this.rangeList)) {
                if (this.rangeList && this.rangeList.length) {
                    return typeof this.rangeList[0] === 'string'
                } else {
                    return true
                }
            } else {
                return false
            }
        }
    },
    components: {
        SelectControl
    }

}
</script>
<style lang="less">

</style>
